/*
	AUTHOR:	W. Max Lees
	FILE:	AppLayer.h
	DATE:	February 24th, 2014

	CLASS AppLayer is provided in the TraceEngine namespace.
	This class will handle the interface with the OS and 
	hardware and handle the app life cycle. Class should be
	inherited by games specific class.

	Based on design by Mike McShaffry and David Graham of 
	"Game Coding Complete, Fourth Edition"
	ISBN-13: 978-1133776574

*/

// Macro Guard
#ifndef _H_APPLAYER
#define _H_APPLAYER

#include <Windows.h>

namespace TraceEngine
{

	class AppLayer
	{
		public:
			// Constructors
			AppLayer( void );

			// Destructor
			//~AppLayer( void );

			// Modification Member Functions
			bool initInstance( void );

			// Constant Member Functions

		private:
			LPCWSTR		m_AppName;
			HINSTANCE	m_Instance;
			HWND		m_Wnd;

			// Value Semantics
			AppLayer( const AppLayer& ) {}
			AppLayer& operator= ( const AppLayer& ) {}

			// Helper Functions
			bool isOnlyInstance( LPCTSTR gameTitle ) const;
			bool checkStorage( const DWORDLONG neededSpace ) const;
			bool checkMemory( const DWORDLONG physRAMNeeded, const DWORDLONG virtRAMNeeded ) const;
			DWORD readCPUSpeed( void ) const;
			void initializeWindows( int& screenWidth, int& screenHeight );

	};

	LRESULT CALLBACK WndProc( HWND hwnd, UINT umsg, WPARAM wparam, LPARAM lparam );

}

#endif // !_H_APPLAYER
